﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MobiShop.Models
{
    public class OrderStatusModels
    {
        public static List<SelectListItem> OrderStatusListItem = ReadOrderStatusListItem();

        public static List<SelectListItem> ReadOrderStatusListItem()
        {
            MobishopEntities db = new MobishopEntities();
            List<OrderStatus> listOrderStatus = db.OrderStatusList.ToList();

            List<SelectListItem> list = new List<SelectListItem>();
            SelectListItem item;

            item = new SelectListItem();
            item.Text = "Chọn trạng thái";
            item.Value = "0";
            list.Add(item);

            foreach (OrderStatus orderStatus in listOrderStatus)
            {
                item = new SelectListItem();
                item.Text = orderStatus.name;
                item.Value = orderStatus.id.ToString();
                list.Add(item);
            }
            return list;
        }
    }
}